package com.wj.im.util;

import javax.servlet.ServletContextEvent;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.WebApplicationContext;

public class InitialContextListener extends ContextLoaderListener {
    @Override
    public void contextInitialized(ServletContextEvent sce) {
        super.contextInitialized(sce);

        ApplicationContext ac = (WebApplicationContext) sce.getServletContext().getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);

        log.debug("{}", ac);
    }

    @Override
    public void contextDestroyed(ServletContextEvent event) {
    }

    private static Logger log = LoggerFactory.getLogger(InitialContextListener.class);
}
